package prototypeDemo.example;

/**
 * @author zsh
 * @Description
 * @create 2022-05-16 19:35
 */
public class Main {
    public static void main(String[] args) {
        //准备,注册实例
        Manager manager = new Manager();
        UnderlinePen ulp = new UnderlinePen('-');
        MessageBox mb1 = new MessageBox('*');
        MessageBox mb2 = new MessageBox('/');
        manager.register("ulp",ulp);
        manager.register("mb1",mb1);
        manager.register("mb2",mb2);

        //复制实例
        Product p1 = manager.create("ulp");
        p1.use("hello, world1!");
        Product p2 = manager.create("mb1");
        p2.use("hello, world2!");
        Product p3 = manager.create("mb2");
        p3.use("hello, world3!");

    }
}
